package Work3;
import java.util.Random;
import java.util.Scanner;
import java.util.ArrayList;

public class Hongbao {
	public static void main(String[] args) {
		Member Qvnzhu = new Member();
		Qvnzhu.wal.Get(1000);
		Qvnzhu.setname("我是群主");
		Qvnzhu.setid(1);
		Member Qvnyou1 = new Member();
		Qvnyou1.wal.Get(50);
		Qvnyou1.setname("群友一号");
		Qvnyou1.setid(2);
		Member Qvnyou2 = new Member();
		Qvnyou2.wal.Get(100);
		Qvnyou2.setname("群友二号");
		Qvnyou2.setid(3);
		Member Qvnyou3 = new Member();
		Qvnyou3.wal.Get(150);
		Qvnyou3.setname("群友三号");
		Qvnyou3.setid(4);
		Member I = new Member();
		I.wal.Get(200);
		I.setname("我");
		I.setid(5);
		System.out.println("群主要发红包了");
		Qvnzhu.showmoney();
		hongbaoinfo hongbao1=Qvnzhu.Send();
		Hongbaoinformation(hongbao1);
		myoperation(I,hongbao1);
		Hongbaoinformation(hongbao1);
		System.out.println("群友一号抢红包");
		Qvnyou1.GetHongbao(Qvnyou1,hongbao1);
		System.out.println("群友二号抢红包");
		Qvnyou2.GetHongbao(Qvnyou2,hongbao1);
		System.out.println("群友三号抢红包");
		Qvnyou3.GetHongbao(Qvnyou3,hongbao1);
		Hongbaoinformation(hongbao1);
	}
	
	public static void myoperation(Member I,hongbaoinfo hb) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请选择操作:");
		System.out.println("0.退出");
		System.out.println("1.显示余额");
		System.out.println("2.显示用户名");
		System.out.println("3.抢红包");
		int num=1;
		while(num!=0) {
			num=sc.nextInt();
			switch(num) {
			case 0:
				return;
			case 1:
				I.showmoney();
				break;
			case 2:
				String name=I.getname();
				System.out.println(name);
				break;
			case 3:
				I.GetHongbao(I,hb);
				break;
			default:
				System.out.println("请选择操作:");
				System.out.println("0.退出");
				System.out.println("1.显示余额");
				System.out.println("2.显示用户名");
				System.out.println("3.抢红包");
			}
		}
		return;	
	}
	
	public static void Hongbaoinformation(hongbaoinfo hb) {
		hb.Info_of_hongbao();
	}
}
